package com.lzg;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author lizhigang Date: 2019/9/12 13:59
 * @description:
 */
public abstract class Card implements Payment {
	public static Map<String,Payment> payStrategy = new HashMap<String,Payment>();
	@PostConstruct
	private void init(){
		payStrategy.put(getType(),this);
	}
	@Override
	public void pay(int cents) {
		System.out.println("use card " +getType()+" pay "+cents+"元");
		executeRepayment(cents);
	}

	public abstract String getType();

	public abstract void executeRepayment(int cents);
}
